package org.spring.springboot.controller;

import org.spring.springboot.service.CategoryService;
import org.spring.springboot.service.GoodsService;
import org.spring.springboot.service.OrderdService;
import org.spring.springboot.service.OrdermService;
import org.spring.springboot.service.StockService;
import org.spring.springboot.service.StoreService;
import org.spring.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;


@RestController
public class TestRestController {

    @Autowired
    private CategoryService categoryService;
    @Autowired
    private GoodsService goodsService;
    @Autowired
    private StockService stockService;
    @Autowired
    private StoreService storeService;
    @Autowired
    private UserService userService;
    @Autowired
    private OrdermService ordermService;
    @Autowired
    private OrderdService orderdService;
 

  
    
    @RequestMapping(value = "/api/1", method = RequestMethod.GET)
    public JSON test() {
    	 JSONObject result =new JSONObject();
        result.put("data",categoryService.findAll()); 
		return result;
    }

    @RequestMapping(value = "/api/2", method = RequestMethod.GET)
    public JSON test2() {
    	 JSONObject result =new JSONObject();
        result.put("data",goodsService.findAll()); 
        System.out.println(result);
		return result;
    }
    @RequestMapping(value = "/api/3", method = RequestMethod.GET)
    public JSON test3() {
    	JSONObject result =new JSONObject();
    	result.put("data",stockService.findAll()); 
    	return result;
    }
    @RequestMapping(value = "/api/4", method = RequestMethod.GET)
    public JSON test4() {
    	JSONObject result =new JSONObject();
    	result.put("data",storeService.findAll()); 
    	return result;
    }
    @RequestMapping(value = "/api/5", method = RequestMethod.GET)
    public JSON test5() {
    	JSONObject result =new JSONObject();
    	result.put("data",userService.findAll()); 
    	return result;
    }
    @RequestMapping(value = "/api/6", method = RequestMethod.GET)
    public JSON test6() {
    	JSONObject result =new JSONObject();
    	result.put("data",ordermService.findAll()); 
    	return result;
    }
    @RequestMapping(value = "/api/7", method = RequestMethod.GET)
    public JSON test7() {
    	JSONObject result =new JSONObject();
    	result.put("data",orderdService.findAll()); 
    	return result;
    }
    
    

}
